import { defineConfig } from 'vite'
import { devtools } from '@tanstack/devtools-vite'
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
import viteReact from '@vitejs/plugin-react'
import viteTsConfigPaths from 'vite-tsconfig-paths'<% if (tailwind) { %>
import tailwindcss from "@tailwindcss/vite"
<% } %><% for(const integration of integrations.filter(i => i.type === 'vite-plugin')) { %><%- integrationImportContent(integration) %>
<% } %>

const config = defineConfig({
  plugins: [devtools(), <% for(const integration of integrations.filter(i => i.type === 'vite-plugin')) { %><%- integrationImportCode(integration) %>,<% } %>
    // this is the plugin that enables path aliases
    viteTsConfigPaths({
      projects: ['./tsconfig.json'],
    }),
    <% if (tailwind) { %>tailwindcss(),<% } %>
    tanstackStart(),
    viteReact(<% if (addOnEnabled.compiler) { %>{
      babel: {
        plugins: ["babel-plugin-react-compiler"],
      },
    }<% } %>),
  ],
})

export default config
